From 77d7237a76ab080b252fc7f8816440b160bf2bf5 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Tue, 23 Mar 2021 12:40:06 -0600 Subject: [PATCH] fix sequence related undefined behavior found by PVS Studio. V567 The modification of the 's' variable is unsequenced relative to another operation on the same variable. This may lead to undefined behavior. --- brauniger_iq.cc | 2 +- garmin_txt.cc | 4 ++-- igc.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/brauniger_iq.cc b/brauniger_iq.cc index 88188259e..071b6b754 100644 --- a/brauniger_iq.cc +++ b/brauniger_iq.cc @@ -54,7 +54,7 @@ inline state_t& operator++(state_t& s) // prefix inline state_t operator++(state_t& s, int) // postfix { state_t ret(s); - s = ++s; + ++s; return ret; } diff --git a/garmin_txt.cc b/garmin_txt.cc index d3fa8c4b1..bf4c91f42 100644 --- a/garmin_txt.cc +++ b/garmin_txt.cc @@ -94,7 +94,7 @@ inline header_type& operator++(header_type& s) // prefix inline header_type operator++(header_type& s, int) // postfix { header_type ret(s); - s = ++s; + ++s; return ret; } @@ -105,7 +105,7 @@ inline gt_display_modes_e& operator++(gt_display_modes_e& s) // prefix inline gt_display_modes_e operator++(gt_display_modes_e& s, int) // postfix { gt_display_modes_e ret(s); - s = ++s; + ++s; return ret; } diff --git a/igc.cc b/igc.cc index 950fdf5a3..1f5d772a5 100644 --- a/igc.cc +++ b/igc.cc @@ -156,7 +156,7 @@ inline state_t& operator++(state_t& s) // prefix inline state_t operator++(state_t& s, int) // postfix { state_t ret(s); - s = ++s; + ++s; return ret; } -- 2.30.2